<div class="formbody">
    <form action="" method="post" name="priceForm" accept-charset="utf-8">
        
        <div class="formtitle">
            <span>饮水机水价设置</span>
        </div>
        <ul class="forminfo">
         	<label>学校:   </label>
               <select name="school" class="select">
                  <?php if (!empty($school)){ foreach ( $school as $k=>$v){?>
                      <option value="<?php echo $v['id']?>" <?php echo $v['id']==$schoolid?'selected':'';?> ><?php echo $v['name']?></option> 
                  <?php } }?>
            </select>
            
            <li>
                <label>热水价格:</label>
                <input type="text" name="normalHot" value="<?php echo empty($prices['normal']['hot']['a']) ? '' : $prices['normal']['hot']['a'] ?>" class="scinput1"  >
                <i>分/秒</i>
                <i class="amount"></i>
                <i>元/秒</i>
            </li>
            <li>
                <label>冷水价格:</label>
                <input type="text" name="normalCold" value="<?php echo empty($prices['normal']['cold']['a']) ? '' : $prices['normal']['cold']['a'] ?>" class="scinput1" >
                <i>分/秒</i>
                <i class="amount"></i>
                <i>元/秒</i>
            </li>
        </ul>
        
       <div class="formtitle">
            <span>脉冲模式</span>
        </div>
        <ul class="forminfo">
            <li>
                <label>热水价格:</label>
                <input type="number" name="pulseHot" value="<?php echo empty($prices['normal']['phot']['a']) ? '' : $prices['normal']['phot']['a'] ?>" class="scinput1"  >
                <i>脉冲/分</i>
                <i class="amountP"></i>
                <i>脉冲/元</i>
            </li>
            <li>
                <label>冷水价格:</label>
                <input type="number" name="pulseCold" value="<?php echo empty($prices['normal']['pcold']['a']) ? '' : $prices['normal']['pcold']['a'] ?>" class="scinput1" >
                <i>脉冲/分</i>
                <i class="amountP"></i>
                <i>脉冲/元</i>
            </li>
        </ul>
<!--         <div class="formtitle"> -->
<!--             <span>按次模式</span> -->
<!--         </div> -->
<!--         <ul class="forminfo"> -->
<!--             <li> -->
<!--                 <label>热水价格:</label> -->
<!--                 <input type="number" name="onceHot" value="" class="scinput1"  > -->
<!--                 <i>分/次</i> -->
<!--                 <i class="amount"></i> -->
<!--                 <i>元/次</i> -->
<!--             </li> -->
<!--             <li> -->
<!--                 <label>冷水价格:</label> -->
<!--                 <input type="number" name="onceCold" value="" class="scinput1" > -->
<!--                 <i>分/次</i> -->
<!--                 <i class="amount"></i> -->
<!--                 <i>元/次</i> -->
<!--             </li> -->
<!--         </ul> -->
        <div class="formtitle"></div>
        <ul class="forminfo">
            <li>
                <label>&nbsp;</label>
                <input name="" type="submit" class="btn" value="确认保存"/>
            </li>
        </ul>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $('.scinput1').each(function() {

            var $input  = $(this);
            var $name = $input.attr("name");

            if( ($name == 'pulseHot') || ($name == 'pulseCold') ){
            	var $amount = $input.next().next('.amountP').css('color','darkorange').text(' '+($input.val()*100));
            }else{
            	var $amount = $input.next().next('.amount').css('color','darkorange').text(' '+($input.val()/100).toFixed(3));
            }
            
            $input.change(function() {
                var price = $input.val();
                if (price<0) {
                    alert('价格不能小于0');
                    price = 0;
                    $input.val(0);
                }

                if( ($name == 'pulseHot') || ($name == 'pulseCold') ){
                	price = (price*100);//脉冲模式
                }else{
                	price = (price/100).toFixed(3);
                }
                
                $amount.text('  '+price);
            });
        });
        $(".select").change(function(){
            var $a = $(this).val();
      	 	var $url = '?sid='+$a;
      	 	window.location.href = $url;
      	})
    })
</script>

